<%@ page import="java.util.List" %>
<%@ page import="csu.web.mypetstore.domain.Item" %>
<%@ page import="csu.web.mypetstore.domain.Product" %>
<%@ include file="../common/top.jsp" %>

<div id="BackLink">
    <a href="categoryForm?categoryId=${sessionScope.searchProduct.categoryId}">Return
        to ${sessionScope.searchProduct.categoryId}</a>
</div>

<div id="Catalog">

    <h2>${sessionScope.searchProduct.name}</h2>

    <table>
        <tr>
            <th>Item ID</th>
            <th>Product ID</th>
            <th>Description</th>
            <th>List Price</th>
            <th>&nbsp;</th>
        </tr>
        <%
            List<Item> searchProductList=(List<Item>) session.getAttribute("searchProductList");
            if(searchProductList!=null){
                for(Item item:searchProductList){
                    Product searchProduct= item.getProduct();
        %>
            <tr>
                <td>
                    <a href="itemForm?itemId=<%=item.getItemId()%>">
                        <%=item.getItemId()%>
                    </a>
                </td>
                <td>
                    <a href="itemForm?itemId=<%=item.getItemId()%>">
                    <%=item.getProduct().getProductId()%>
                    </a>
                </td>
                <td><%=item.getAttribute1()%> <%=searchProduct.getName()%>
                </td>
                <td><fmt:formatNumber value="<%=item.getListPrice()%>"
                                      pattern="$#,##0.00"/></td>
                <td>
                    <a href="addItemToCart?workingItemId=<%=item.getItemId()%>" class="Button">Add to Cart</a>
                </td>
            </tr>
       <%
           }
           }
       %>
    </table>
</div>

<%@ include file="../common/bottom.jsp" %>





